<template>
	<view class="padding-30">
		<choose-tabs IsFontView :list="tabsList" :checkIndex="tabIndex" @checkView="handleTabs"/>
		<view class="margin-top50">
			<list-item :list="withdrawalList"></list-item>
		</view>
		<view v-if="withdrawalList&&withdrawalList.length<1" style="margin-top: 200rpx;">
			<u-empty color="#ffffff" icon-color="#ffffff" text="暂无提现记录" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	import chooseTabs from "@/components/tabs/chooseTabs.vue"
	import listItem from "@/components/list/list-item.vue"
	export default{
		components:{
			chooseTabs,
			listItem
		},
		data(){
			return{
				tabIndex:0,
				tabsList:[
					{name:'收益分红'},
					{name:'团队钱包'},
					{name:'余额'},
				],
				withdrawalList:[],
				type:'guoliang'
			}
		},
		onShow() {
			this.getWithdrawalList()
		},
		methods:{
			getWithdrawalList(){
				this.$http.post(this.$api.getWithdrawalList,{type:this.type},{token:true}).then(res=>{
					console.log(res)
					if(res.code == 1){
						this.withdrawalList = res.data.map(item=>{
							return {
								time: item.create_time,
								desc:item.status == 1? '提现成功':'待审核',
								price:item.amount
							}
						})
					}
				})
			},
			handleTabs(index){
				this.tabIndex = index
				if(this.tabIndex == 0){
					this.type = 'guoliang'
				}else if(this.tabIndex == 1){
					this.type = 'elimit'
				}else{
					this.type = 'user_money'
				}
				this.getWithdrawalList()
			},
		}
	}
</script>

<style>
</style>